package
        com.chb.service.impl;

import com.chb.dao.SysOperLogDao;
import com.chb.model.entity.SysOperLog;
import com.chb.model.vo.PageBean;
import com.chb.service.SysOperLogService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author：xIAO_ZHOU_TX
 * @date：Created in 2023/10/10 20:50
 * @description： 操作日志
 * @modified By：
 * @version:
 */
@Service
public class SysOperLogServiceImpl implements SysOperLogService {
    @Autowired
    private SysOperLogDao sysOperLogDao;

    /**
     * @param
     * @return
     * @create by: xIAO_ZHOU
     * @description: 查询所有日志信息
     * @create time: 2023/10/11 11:36
     */
    @Override
    public PageBean<SysOperLog> selectAll(Integer currentPage, Integer pageSize) {
        //分页插件
        PageHelper.startPage(currentPage, pageSize);
        List<SysOperLog> allOperLog = sysOperLogDao.findAllOperLog();
        PageInfo<SysOperLog> pageInfo = new PageInfo<>(allOperLog);
        return new PageBean<SysOperLog>(pageInfo.getTotal(), pageInfo.getList());
    }

    @Override
    public void addLog(SysOperLog sysOperLog) {
        sysOperLogDao.insertRole(sysOperLog);
    }
}